'use strict';

module.exports = app => {
  const { router, controller: { userInfo }, middleware: { validator, checkPageTable, checkParams } } = app;

  const baseUrl = '/api/userInfo';
  router.get(baseUrl + '/my', userInfo.indexMy);
  router.get(baseUrl + '/user/:uid', checkParams('uid'), userInfo.showUser);
  router.get(baseUrl, checkPageTable(), userInfo.index);
  router.get(baseUrl + '/:id', checkParams(), userInfo.show);
  router.post(baseUrl, validator('userInfo.create'), userInfo.create);
  router.put(baseUrl + '/:id', validator('userInfo.update'), userInfo.update);
};
